from flask import Flask, request, jsonify
from flask_cors import CORS

app = Flask(__name__)
CORS(app)  # 允许所有域名的跨域请求

@app.route('/line', methods=['GET'])
def line():
    k = float(request.args.get('k', 1))
    b = float(request.args.get('b', 0))
    x_values = list(range(10))
    y_values = [k * x + b for x in x_values]
    return jsonify({'x': x_values, 'y': y_values})

if __name__ == '__main__':
    app.run(port=9090)